from tortoise import fields, models
class FoundLotEverydayBalance(models.Model):
    id = fields.BigIntField(pk=True)
    record_status = fields.IntField(default=1, description="记录状态:1-有效;0-无效")
    create_time = fields.DatetimeField(auto_now_add=True, description="记录创建时间")
    update_time = fields.DatetimeField(auto_now=True, description="记录修改时间")
    found_code = fields.CharField(max_length=50, default='', description="基金编码")
    found_name = fields.CharField(max_length=200, default='', description="基金名称")
    lot_code = fields.CharField(max_length=50, default='', description="批次号")
    base_date = fields.DateField(null=True, description="日期")
    base_si_price = fields.DecimalField(max_digits=10, decimal_places=4, default=0.0000, description="单位净值")
    rate = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="涨幅")
    holding_shares = fields.DecimalField(max_digits=10, decimal_places=4, default=0.0000, description="持有份额")
    holding_si_price = fields.DecimalField(max_digits=10, decimal_places=4, default=0.0000, description="持仓平均成本（含已卖出部分的盈利或者亏损）")
    holding_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="持仓总成本")
    base_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="当天市值")
    total_earn_amount = fields.DecimalField(max_digits=10, decimal_places=2, default=0.00, description="累计盈亏金额")

    class Meta:
        table = "found_lot_everyday_balance"
        table_description = "基金批次每日余额表"
